package fairy_tale;

import core.Oma;
import core.Rotkaeppchen;
import core.VerwunschenerWald;

public class Maerchenwelt {

    //This attribute describes the width of the forest (area of the xcoordinates)
    private int x;

    //This attribute describes the height of the forest (area of the y coordinates)
    private int y;

    // During the trip, this attribute holds the current map of the forest, on which the positions of all hazards, trees and figures are recorded
    private VerwunschenerWald[][] karte;

    private Oma oma;

    private Rotkaeppchen rotkaeppchen;


    public Maerchenwelt(int x, int y, int gefahrenAnzahl, int baumAnzahl){
        this.x = x;
        this.y = y;
        this.karte = new VerwunschenerWald[gefahrenAnzahl][baumAnzahl];
    }

    public VerwunschenerWald[][] getKarte(){
        return this.karte;
    }

    public Rotkaeppchen getRotkaeppchen(){
        return this.rotkaeppchen;
    }

    public Oma getOma(){
        return this.oma;
    }

    public void printWald(){
        //Rahmen:linke obere Ecke
        System.out.print("+");
        //Rahmen:erste Zeile
        for(int i = 0;i < x ;i++){
            System.out.print("-");
        }
        //Rahmen:rechte obere Ecke
        System.out.println("+");
        for(int j = 0;j < y;j++){
            //Rahmen:linker Rand
            System.out.print("|");

            //Die eigentliche Karte
            for(int i = 0; i < x;i++){
                if(karte[i][j] != null ){
                    System.out.print(karte[i][j].getName());
                }else {
                    System.out.print(" ");
                }
            }

            //Rahmen:rechter Rand
            System.out.println("|");
        }
        //Rahmen:linke untere Ecke
        System.out.print("+");
        //Rahmen:letzte Zeile
        for(int i = 0;i < x;i++){
            System.out.print("-");
        }
        //Rahmen:rechte untere Ecke
        System.out.print("+");
    }
}
